<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">主页</a>
        <a><cite>商户管理</cite></a>
        <a><cite>查看商户</cite></a>
    </div>
</div>

<style>
    .layui-form-label {
        width:15% !important;
        margin-left:1%;
    }
    .layui-input-inline {
        width: 33% !important;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <form class="layui-form layui-form-pane">
            <div class="layui-tab layui-tab-brief">
                <ul class="layui-tab-title">
                    <li class="layui-this">基本信息</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-form-item">
                        <label class="layui-form-label">商户ID</label>
                        <div class="layui-input-inline">
                            <input type="text" id="mchId" name="mchId" lay-verify="required" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                        <label class="layui-form-label">商户名称</label>
                        <div class="layui-input-inline">
                            <input type="text" id="name" name="name" lay-verify="required" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商户状态</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="status" value="1" title="启用" checked="checked" disabled="disabled">
                            <input type="radio" name="status" value="0" title="停止" disabled="disabled">
                        </div>
                        <label class="layui-form-label">所属代理商ID</label>
                        <div class="layui-input-inline">
                            <input type="text" id="agentId" name="agentId" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">用户登录名</label>
                        <div class="layui-input-inline">
                            <input type="text" id="userName" name="userName" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                        <label class="layui-form-label">真实姓名</label>
                        <div class="layui-input-inline">
                            <input type="tel" id="realName" name="realName" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">身份证号</label>
                        <div class="layui-input-inline">
                            <input type="text" id="idCard" name="idCard" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                        <label class="layui-form-label">手机号</label>
                        <div class="layui-input-inline">
                            <input type="tel" id="mobile" name="mobile" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">QQ号</label>
                        <div class="layui-input-inline">
                            <input type="text" id="qq" name="qq" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                        <label class="layui-form-label">邮箱</label>
                        <div class="layui-input-inline">
                            <input type="text" id="email" name="email" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">网站名称</label>
                        <div class="layui-input-inline">
                            <input type="text" id="siteName" name="siteName" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                        <label class="layui-form-label">网站地址</label>
                        <div class="layui-input-inline">
                            <input type="tel" id="siteUrl" name="siteUrl" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">通讯地址</label>
                        <div class="layui-input-inline">
                            <input type="text" id="address" name="address" class="layui-input" disabled="disabled">
                        </div>
                        <label class="layui-form-label">唯一标识</label>
                        <div class="layui-input-inline">
                            <input type="text" id="tag" name="tag" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">线下充值费率(%)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="offRechargeRate" name="offRechargeRate" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                        <label class="layui-form-label">创建时间</label>
                        <div class="layui-input-inline">
                            <input type="text" id="createTime" name="createTime" class="layui-input" disabled="disabled">
                        </div>
                    </div>
                </div>
                <ul class="layui-tab-title">
                    <li class="layui-this">开户信息</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-form-item">
                        <label class="layui-form-label">开户行名称</label>
                        <div class="layui-input-inline">
                            <input type="text" id="bankName" name="bankName" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                        <label class="layui-form-label">开户网点名称</label>
                        <div class="layui-input-inline">
                            <input type="text" id="bankNetName" name="bankNetName" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">账户名</label>
                        <div class="layui-input-inline">
                            <input type="text" id="accountName" name="accountName" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                        <label class="layui-form-label">账户号</label>
                        <div class="layui-input-inline">
                            <input type="text" id="accountNo" name="accountNo" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">开户所在省</label>
                        <div class="layui-input-inline">
                            <input type="text" id="province" name="province" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                        <label class="layui-form-label">开户所在市</label>
                        <div class="layui-input-inline">
                            <input type="text" id="city" name="city" autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                    </div>
                </div>
                <ul class="layui-tab-title">
                    <li class="layui-this">账户信息</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-form-item">
                        <label class="layui-form-label">账户余额(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="balance" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">不可用余额(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="unBalance" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">可结算金额(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="settAmount" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">保证金(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="securityMoney" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">冻结金额(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="frozenMoney" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">代付余额(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="agentpayBalance" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">不可用代付余额(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="unAgentpayBalance" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block" style="padding-bottom: 20px;">
                        <a class="layui-btn" lay-href="merchant/list/">返回</a>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<script>
    layui.use(['admin','form'],function(){
        var form = layui.form
        ,$ = layui.$
        ,admin = layui.admin
        ,element = layui.element
        ,layer = layui.layer ;
        // 导航
        element.render('breadcrumb', 'breadcrumb');
        var router = layui.router();
        var mchId = router.search.mchId;
        admin.req({
            type: 'get',
            url: layui.setter.baseUrl + '/mch_info/get',
            data: {
                mchId : mchId
            },
            error: function(err){
                layer.alert(JSON.stringify(err.field), {
                    title: '错误提示'
                })
            },
            success: function(res){
                if(res.code == 0){
                    $('#mchId').val(res.data.mchId);
                    $('#name').val(res.data.name);
                    $('#mchRate').val(res.data.mchRate);
                    $('#userName').val(res.data.userName);
                    $('#realName').val(res.data.realName);
                    $('#idCard').val(res.data.idCard);
                    $('#mobile').val(res.data.mobile);
                    $('#qq').val(res.data.qq);
                    $('#email').val(res.data.email);
                    $('#siteName').val(res.data.siteName);
                    $('#siteUrl').val(res.data.siteUrl);
                    $("input[name='status'][value='"+res.data.status+"']").attr("checked",true);
                    $('#agentId').val(res.data.agentId);
                    $('#address').val(res.data.address);
                    $('#tag').val(res.data.tag);
                    $('#bankName').val(res.data.bankName);
                    $('#bankNetName').val(res.data.bankNetName);
                    $('#accountName').val(res.data.accountName);
                    $('#accountNo').val(res.data.accountNo);
                    $('#province').val(res.data.province);
                    $('#city').val(res.data.city);
                    $('#offRechargeRate').val(res.data.offRechargeRate);
                    if(res.data.createTime != "" && res.data.createTime != null) {
                        $('#createTime').val(layui.util.toDateString(res.data.createTime));
                    }
                    form.render();
                }
            }
        });

        admin.req({
            type: 'get',
            url: layui.setter.baseUrl + '/account/get',
            data: {
                mchId : mchId
            },
            error: function(err){
                layer.alert(JSON.stringify(err.field), {
                    title: '错误提示'
                })
            },
            success: function(res){
                if(res.code == 0){
                    $('#balance').val(res.data.balance/100);
                    $('#unBalance').val(res.data.unBalance/100);
                    $('#totalIncome').val(res.data.totalIncome/100);
                    $('#totalExpend').val(res.data.totalExpend/100);
                    $('#todayIncome').val(res.data.todayIncome/100);
                    $('#todayExpend').val(res.data.todayExpend/100);
                    $('#settAmount').val(res.data.settAmount/100);
                    $('#securityMoney').val(res.data.securityMoney/100);
                    $('#agentpayBalance').val(res.data.agentpayBalance/100);
                    $('#unAgentpayBalance').val(res.data.unAgentpayBalance/100);
                    $('#frozenMoney').val(res.data.frozenMoney/100);

                    if(res.data.status == 1) {
                        $('#status').val("启用");
                    }else {
                        $('#status').val("停止");
                    }
                    if(res.data.createTime != "" && res.data.createTime != null) {
                        $('#createTime').val(layui.util.toDateString(res.data.createTime));
                    }
                    form.render();
                }
            }
        });
    })
</script>